﻿@model IEnumerable<Bieb.Web.Models.Stories.ViewStoryModel>

<table class="table table-bordered table-condensed table-striped table-hover">
    <tr>
        <th>@BiebResources.StoryStrings.TitleHeader</th>
        <th>@BiebResources.StoryStrings.ByHeader</th>
        <th>@BiebResources.StoryStrings.FromBookHeader</th>
    </tr>

@foreach (var story in Model) 
{
    <tr>
        <td>@Html.ActionLink(story.Title, "Details", new { controller = "Stories", id = story.Id })</td>
        <td>
            @Html.Raw(String.Join(",<br /> ", story.Authors.Select(p => Html.ActionLink(p.Text, "Details", new { controller = "People", id = p.Id }).ToHtmlString()).ToArray()))
        </td>
        <td>
            @if(story.Book != null)
            {
                <span>@Html.ActionLink(story.Book.Text, "Details", new { controller = "Books", id = story.Book.Id })</span>
            }
        </td>
    </tr>
}
</table>